$(function() {
	/* 点击页面切换 */
	$("#section_box_inside_left_ul li").click(
			function() {

				$(this).parent().parent().find(
						".section_box_left_div_comment_bywujinshan:eq("
								+ ($(this).index()) + ")").show();
				$(this).parent().parent().find(
						".section_box_left_div_comment_bywujinshan:eq("
								+ ($(this).index()) + ")").siblings().hide();
				$(this).parent().parent().find("#section_box_inside_left_ul")
						.show();
				// /*按钮切换特效*/
				$(this).css({
					"border-right" : "none",
					"border-bottom" : "none",
					"border-left" : "solid 5px #65C2C7",
					"background-color" : "white"
				});
				$(this).siblings().css({
					"border-right" : "solid 1px darkgray",
					"background-color" : "#CFE0E8",
					"border-left" : "none",
				});

			})

	/* 中心信息页面简单切换 */
	$("#modify_info").click(function() {
		$(this).fadeOut();
		$("#sureButton").fadeIn();
		
		
		
		
		
		$(".underline_div input").show();
//		$(".hide_input input").show();
//		$(".underline_div select").show();
//		$(".comment_large_div textarea").show();
		$(".info_unselect").hide();

	})
//确认修改姓名
	$("#sureButton").click(function(){
		$(".underline_div input").hide();
		$(".info_unselect").show().text($(".underline_div input").val());
		$(this).fadeOut();
		$("#modify_info").fadeIn();
		var realUserNameNow=$("#update_form_name_check").val();
		$.ajax({
			url : "/GDZjiajiaowang/ChangeTeacherNameServlet",
			type : "POST",
			data : "teacherName=" + realUserNameNow,
			success : function(result) {
//					alert(result)
			}
			
			
			
		})
		
		
		
	})
	
	
	
	
	
	
	
	$("#send_newacts").click(function() {
		$("#send_newacts").hide();
		$("#modify_info").show();
		$(".underline_div input").hide();
		$(".hide_input input").hide();
		$(".underline_div select").hide();
		$(".comment_large_div textarea").hide();
		$(".info_unselect").show();
		
		
		
		
	})

	// 修改登录用户的个人信息
	$('#send_newacts')
			.click(
					function() {
						alert("ok.....")
						var name_check = $('#update_form_name_check').val();
						var sex_check = $('#update_form_sex_check').val();
						var school_check = $('#update_form_school_check').val();
						var major_check = $('#update_form_major_check').val();
						var retime_check = $('#update_form_retime_check').val();
						var phone_check = $('#update_form_phone_check').val();
						var comment_check = $('#update_form_comment_check')
								.val();
						var identity_check = $('#update_form_identity_check')
								.val();
						var job_check = $('#update_form_job_check').val();
						var reward_check = $('#update_form_reward_check').val();
						var subject_check = $('#update_form_subject_check')
								.val();
						var address_check = $('#update_form_address_check')
								.val();
						var teacherId = $("#teacher_no").text();
						$
								.ajax({
									type : "post",
									url : "http://localhost:8080/GDZjiajiaowang/PersonalCenterIdentityServlet",
									data : {
										"name_check" : name_check,
										"sex_check" : sex_check,
										"school_check" : school_check,
										"major_check" : major_check,
										"retime_check" : retime_check,
										"phone_check" : phone_check,
										"comment_check" : comment_check,
										"identity_check" : identity_check,
										"job_check" : job_check,
										"reward_check" : reward_check,
										"subject_check" : subject_check,
										"address_check" : address_check,
										"teacherId" : teacherId
									},
									dataType : "json",
									contentType : "application/x-www-form-urlencoded; charset=utf-8",
									success : function(data) {
										alert("修改成功");
										$("#update_form_name_show").text(
												data.teacherRealName);
										$("#update_form_name_check").val(
												data.teacherRealName);

										$("#update_form_sex_show").text(
												data.teacherSex);
										$("#update_form_sex_check")
												.find(
														"option[value="
																+ data.teacherSex
																+ "]").attr(
														"selected", "selected");
										$("#update_form_sex_check")
												.find(
														"option[value="
																+ data.teacherSex
																+ "]")
												.siblings().removeAttr(
														"selected");
										$("#update_form_school_show").text(
												data.teacherUniversity);
										$("#update_form_school_check").val(
												data.teacherUniversity);

										$("#update_form_major_show").text(
												data.teacherSpeciality);
										$("#update_form_major_check").val(
												data.teacherSpeciality);

										$("#update_form_country_show").text(
												data.teacherNative);
										$("#update_form_country_check").val(
												data.teacherNative);

										$("#update_form_retime_show").text(
												data.teacherRegisterDate);
										$("#update_form_retime_check").val(
												data.teacherRegisterDate);

										$("#update_form_phone_show").text(
												data.teacherPhone);
										$("#update_form_phone_check").val(
												data.teacherPhone);

										$("#update_form_name_show").text(
												data.teacherRealName);
										$("#update_form_name_check").val(
												data.teacherRealName);

										$("#update_form_comment_show").text(
												data.selfmark);
										$("#update_form_comment_check").val(
												data.selfmark);

										$("#update_form_identity_show").text(
												data.teacherIdentity);
										$("#update_form_identity_check").val(
												data.teacherIdentity);

										$("#update_form_job_show").text(
												data.type);
										$("#update_form_job_check").val(
												data.type);

										$("#update_form_reward_show").text(
												data.certificate);
										$("#update_form_reward_check").val(
												data.certificate);

										$("#update_form_subject_show").text(
												data.subjectName);
										$("#update_form_subject_check").val(
												data.subjectName);

									},
								})

					})

			
//	$(".subject_teached span").click(function() {
//		if ($(this).hasClass("choosedSubject")) {
//			$(this).removeClass("choosedSubject");
//			var subjectId = $(this).value();
//			var teacherId = $("#teacher_no").text();
//			var json = {
//				"teacherId" : teacherId,
//				"subjectId" : subjectId,
//				"op" : "delete"
//			}
//			$.ajax({
//				url : "/GDZjiajiaowang/teacherChangeSubject",
//				type : "POST",
//				data : formData,
//				success : function(result) {
//					alert("成功");
//				},
//
//			})
//		} else {
//			$(this).addClass("choosedSubject");
//
//		}
//
//	})
					
					
					
					
});
